package com.modbus.tcp.service.impl;

import java.util.List;

import com.modbus.tcp.domain.Ballvalvedata;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.modbus.tcp.mapper.BallvalveaddrMapper;
import com.modbus.tcp.domain.Ballvalveaddr;
import com.modbus.tcp.service.IBallvalveaddrService;
import com.modbus.tcp.utils.Convert;
import org.springframework.web.bind.annotation.RestController;

/**
 * 球阀modbus地址 服务层实现
 *
 * @author d
 * @date 2024-01-11
 */
@RestController
public class BallvalveaddrServiceImpl implements IBallvalveaddrService {

    @Autowired
    private BallvalveaddrMapper ballvalveaddrMapper;

    @Override
    public  Ballvalveaddr selectBallvalveByPartcode(long id,long partcode){
        return ballvalveaddrMapper.selectBallvalveByPartcode(id,partcode);
    }


    /**
     * 查询球阀modbus地址信息
     *
     * @param ballvalueid 球阀modbus地址ID
     * @return 球阀modbus地址信息
     */
    @Override
    public Ballvalveaddr selectBallvalveaddrById(Integer ballvalueid) {
        return ballvalveaddrMapper.selectBallvalveaddrById(ballvalueid);
    }

    /**
     * 查询球阀modbus地址列表
     *
     * @param ballvalveaddr 球阀modbus地址信息
     * @return 球阀modbus地址集合
     */
    @Override
    public List<Ballvalveaddr> selectBallvalveaddrList(Ballvalveaddr ballvalveaddr) {
        return ballvalveaddrMapper.selectBallvalveaddrList(ballvalveaddr);
    }

    @Override
    public  List<Ballvalveaddr> selectSensorData( Integer id){
        return ballvalveaddrMapper.selectSensorData(id);
    }

    @Override
    public List<Ballvalveaddr> allBallvalveaddr(){
        return ballvalveaddrMapper.allBallvalveaddr();
    }

    @Override
    public List<Ballvalveaddr> selectShengGuangOpen(){
        return ballvalveaddrMapper.selectShengGuangOpen();

    }

    @Override
    public List<Ballvalveaddr> selectShengGuangClose(){
        return ballvalveaddrMapper.selectShengGuangClose();

    }
    /**
     * 新增球阀modbus地址
     *
     * @param ballvalveaddr 球阀modbus地址信息
     * @return 结果
     */
    @Override
    public int insertBallvalveaddr(Ballvalveaddr ballvalveaddr) {
        return ballvalveaddrMapper.insertBallvalveaddr(ballvalveaddr);
    }

    /**
     * 修改球阀modbus地址
     *
     * @param ballvalveaddr 球阀modbus地址信息
     * @return 结果
     */
    @Override
    public int updateBallvalveaddr(Ballvalveaddr ballvalveaddr) {
        return ballvalveaddrMapper.updateBallvalveaddr(ballvalveaddr);
    }

    /**
     * 删除球阀modbus地址对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBallvalveaddrByIds(String ids) {
        return ballvalveaddrMapper.deleteBallvalveaddrByIds(Convert.toStrArray(ids));
    }
}